﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Yxinmt.Interface
{
    public interface IWindow
    {
        Guid Id { get; set; }
        string Name { get; set; }

        string Title { get; set; }

        IEventAction EventAction { get; set; }

        List<IComponent> ComponentList { get; set; }
        List<IControl> ControlList { get; set; }
        System.Windows.Controls.Grid Grid { get; set; }

        /// <summary>
        /// 获取控件元素列表
        /// </summary>
        /// <returns></returns>
        List<System.Windows.FrameworkElement> GetElements();

        /// <summary>
        /// 事件加载
        /// </summary>
        void EventLoad();

        /// <summary>
        /// 数据加载
        /// </summary>
        void DataLoad();

        void PageLoad();

        System.Drawing.Point StartPoint { get; set; }

        int TabIndex { get; set; }

        /// <summary>
        /// 事件调用
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <param name="control"></param>
        void EventInvoke(object sender, EventArgs e, IControl control);

        /// <summary>
        /// 双击或多击事件调用
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <param name="control"></param>
        void DoubleEventInvoke(object sender, EventArgs e, IControl control);

        IWindow ParentWindow { get; set; }
        System.Windows.Window Window { get; set; }

        /// <summary>
        /// 初始化组件
        /// </summary>
        /// <param name="dict"></param>
        /// <param name="componentList"></param>
        void InitComponent(Dictionary<string, object> dict, List<IComponent> componentList);


        Dictionary<Guid, IDataGridViewControls> DataGridViewControlsDictionary { get; set; }

        void Alert(string message, Action callback = null);

        void Confrim(string message, Action callback = null);

        /// <summary>
        /// 弹出对话框
        /// </summary>
        /// <param name="message"></param>
        /// <returns></returns>
        void Alert(string entityName, string methodName, Exception ex, Action callback = null);

        void Alert(string entityName, string methodName, string message, Exception ex, Action callback = null);

        void ShowAlertMessageList(string message, List<Dictionary<string, object>> messageList, Action callback = null);

        /// <summary>
        /// 关闭窗体
        /// </summary>
        /// <returns></returns>
        void CloseWindow();

        /// <summary>
        /// 是否关闭
        /// </summary>
        bool IsClosed { get; set; }

        /// <summary>
        /// 是否弹出窗体方式
        /// </summary>
        bool IsDialogWindow { get; set; }

        bool IsShowWindow { get; set; }


        List<IControl> ScrollViewerList { get; set; }

        void CloseDialog();

        void GridPageLoad();

        void DataLoadAsync();

        Task TaskRun(string name, bool blAlert, Action action);

        void SetVisible(IWindow preWindow, Dictionary<string, object> parameters);

        void SetGridVisbile();

        void ShowLoad();

        List<IControl> PopupList { get; set; }

        Action RefreshAction { get; set; }

        void ClosePage();

        System.Windows.Window GetNewWindow();
    }
}
